package net.dgg.zz.production.nodeOverdue.service;

import com.alibaba.fastjson.JSONObject;
import net.dgg.iboss.base.util.datatable.domain.DataTableRequest;
import net.dgg.iboss.base.util.datatable.domain.DataTableResponse;
import net.dgg.tmd.foundation.platform.user.entity.UserEntity;
import net.dgg.zz.common.dto.TimeoutPunishDto;
import net.dgg.zz.production.nodeOverdue.dto.DeductionAppealDto;
import net.dgg.zz.production.nodeOverdue.dto.UpdateDeductionAppealDto;
import org.springframework.ui.Model;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * 超期扣罚申诉
 */
public interface FlscNodeOverdueService {

    /**
     * 到cms公共节点管理中，查询超期节点记录
     * @param params
     * @param user
     * @return
     */
    JSONObject selectNodeOverdueRecord(Map<String, Object> params, UserEntity user) throws IOException;

    /**
     *根据扣罚记录id，查询扣罚记录
     * @param id 超期节点id
     * @return
     */
    TimeoutPunishDto queryTimeoutPunishById(Long id) throws IOException;

    /**
     * 提交扣罚申诉
     * @param map 页面传递信息
     * @param user 当前登录用户
     */
    void deductionAppeal(Map<String, Object> map, UserEntity user) throws IOException;

    /**
     * 查询申诉待审核订单
     * @param params  页面参数
     * @param u
     * @return
     */
    JSONObject queryAppealWithPage(Map<String, Object> params, UserEntity u);

    /**
     * 撤回扣罚申诉
     * @param id 扣罚申诉id
     * @param appealId
     * @param u
     */
    void withdrawAppeal(Long id, Long appealId, UserEntity u) throws IOException;


    /**
     * 根据id，查询扣罚申诉
     * @param id 扣罚申诉id
     */
    List<DeductionAppealDto> getAppealByPunishId(Long id, Long appealId) throws IOException;

    /**
     * 对扣罚申诉进行修改
     * @param dto 扣罚申诉
     */
    void updateAppealById(UpdateDeductionAppealDto dto) throws IOException;

    /**
     * 扣罚申诉审核
     * @param map
     * @param user
     */
    void deductionAppealReview(Map<String, Object> map, UserEntity user) throws IOException;

    /**
     * 继续进行扣罚申请
     * @param dto  申诉记录对象
     * @param remark   申诉理由
     * @param flowUser 审核用户
     * @param user  当前登录用户
     */
    //void continueAppeal(Long id, Long appealId, String remark, UserEntity flowUser, UserEntity user) throws IOException;
    void continueAppeal(DeductionAppealDto dto, String remark, UserEntity flowUser, UserEntity user) throws IOException;

    /**
     * 查询扣罚记录，返回参数弹窗页面
     * @param id  扣罚id
     * @param appealId  申诉记录id
     * @param user  当前登录用户
     * @param model  保存传递到页面的参数
     */
    void deductionAppealHtml(Long id, Long appealId, UserEntity user, Model model) throws IOException;

    /**
     * 分页查询申诉待审核
     * @param params  页面参数
     * @param u  当前登录用户
     * @param r
     */
    DataTableResponse appealWaitReview(Map<String, Object> params, UserEntity u, DataTableRequest r);

    /**
     * 分页查询已完成申诉
     * @param params  页面参数
     * @param u  当前登录用户
     * @param r
     */
    DataTableResponse appealAlready(Map<String, Object> params, UserEntity u, DataTableRequest r);

    /**
     * 分页查询申诉驳回记录
     * @param params  页面参数
     * @param u  当前登录用户
     * @param r
     */
    DataTableResponse appealReject(Map<String, Object> params, UserEntity u, DataTableRequest r);
    /**
     * 根据扣罚记录id，查询全部申诉记录都进行返回
     * @param id 扣罚记录id
     * @return
     * @throws IOException
     */
    List<DeductionAppealDto> getAppealRecord(Long id) throws IOException;
}
